<?php


$conn = mysql_connect("sinadb.cupfdqlhvurq.us-east-1.rds.amazonaws.com","eric","038613206");

if (!$conn) {
    die('Could not connect: ' . mysql_error());
}

$db_selected = mysql_select_db("sinadb",$conn);

	$num = 0;
	//查一下有没有这个UID存在，有的话，UPDATE.
	$sql = "select * from sina_users where allow_all_act_msg = 1";
	$rel = mysql_query($sql,$conn);
	while($row=mysql_fetch_array($rel)){
		$num ++;
    	//print_r($row);
    	$userdetail[] =<<<HTML
    	<div class="user">
    		<span> name : {$row['screen_name']} </span>
    		<span>gender: {$row['gender']} </span>
    		<span>city:  {$row['city']} </span>
    		<span>location: {$row['location']} </span>
    		<span>可以评论：{$row['allow_all_comment']} </span>
    		<span>可以私信：{$row['allow_all_act_msg']} </span>
    	</div>
    	
HTML;
	}
	
		    
mysql_close($conn);
?>
<!DOCTYPE html> 
<html>
<head>
	<title>新浪获得的用户数据</title>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<meta http-equiv="pragma" content="no-cache" />
	<style type="text/css">
		body {width: 1000px;}
		.user{height: 18px;}
		.user span{float: left; margin-left: 20px;}
	</style>
</head>

<body>

<?php
echo "总查询到 $num 个用户 <br/> ";
foreach($userdetail as $user){
	echo $user;
	
}


?>

</body>
</html>